/**
 * WMS打印样式
 * 
 * 专门为打印输出优化的样式
 * 确保打印时内容清晰、布局合理
 */

@media print {
  /* ================================
   * 基础打印设置
   * ================================ */
  
  * {
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  /* 页面设置 */
  @page {
    margin: 1cm;
    size: A4;
  }
  
  /* ================================
   * 隐藏不打印元素
   * ================================ */
  
  /* 隐藏交互元素 */
  .wms-button,
  .wms-pagination,
  .wms-toolbar,
  .wms-sidebar,
  .wms-menu,
  .wms-form__actions,
  .wms-table__actions,
  .no-print {
    display: none !important;
  }
  
  /* 隐藏导航元素 */
  nav,
  .navbar,
  .breadcrumb,
  .tabs,
  .pagination {
    display: none !important;
  }
  
  /* 隐藏装饰元素 */
  .badge,
  .tooltip,
  .popover,
  .dropdown,
  .modal-backdrop {
    display: none !important;
  }
  
  /* ================================
   * 页面布局优化
   * ================================ */
  
  html {
    font-size: 12pt;
    line-height: 1.3;
  }
  
  body {
    font-family: "Times New Roman", serif;
    font-size: 12pt;
    line-height: 1.3;
    color: #000;
    background: #fff;
    margin: 0;
    padding: 0;
  }
  
  /* 容器优化 */
  .wms-container,
  .container,
  .container-fluid {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* 卡片打印优化 */
  .wms-card,
  .card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
    margin-bottom: 20pt !important;
    page-break-inside: avoid;
    background: #fff !important;
  }
  
  .wms-card__header,
  .card-header {
    background: #f5f5f5 !important;
    border-bottom: 1px solid #000 !important;
    padding: 10pt !important;
    font-weight: bold;
  }
  
  .wms-card__body,
  .card-body {
    padding: 15pt !important;
  }
  
  /* ================================
   * 表格打印优化
   * ================================ */
  
  .wms-table,
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 20pt !important;
    page-break-inside: auto;
  }
  
  .wms-table__header-cell,
  .wms-table__body-cell,
  th,
  td {
    border: 1px solid #000 !important;
    padding: 8pt !important;
    text-align: left !important;
    vertical-align: top !important;
    word-wrap: break-word;
    font-size: 10pt !important;
  }
  
  .wms-table__header,
  thead {
    display: table-header-group !important;
    background: #f0f0f0 !important;
  }
  
  .wms-table__header-cell,
  th {
    font-weight: bold !important;
    background: #e0e0e0 !important;
  }
  
  .wms-table__body,
  tbody {
    display: table-row-group !important;
  }
  
  .wms-table__footer,
  tfoot {
    display: table-footer-group !important;
  }
  
  /* 表格行打印控制 */
  .wms-table__body-row,
  tr {
    page-break-inside: avoid;
  }
  
  /* 长表格分页处理 */
  .wms-table--long {
    page-break-after: auto;
  }
  
  .wms-table--long thead {
    display: table-header-group;
  }
  
  /* ================================
   * 表单打印优化
   * ================================ */
  
  .wms-form,
  form {
    margin-bottom: 20pt;
  }
  
  .wms-form__item,
  .form-group {
    margin-bottom: 10pt !important;
    page-break-inside: avoid;
  }
  
  .wms-form__label,
  label {
    font-weight: bold !important;
    margin-bottom: 3pt !important;
    display: block !important;
  }
  
  .wms-form__control,
  input,
  select,
  textarea {
    border: none !important;
    border-bottom: 1px solid #000 !important;
    background: transparent !important;
    padding: 2pt 0 !important;
    font-size: 10pt !important;
    color: #000 !important;
    width: 100% !important;
  }
  
  /* 复选框和单选框 */
  input[type="checkbox"],
  input[type="radio"] {
    width: auto !important;
    margin-right: 5pt !important;
  }
  
  /* ================================
   * 文本内容优化
   * ================================ */
  
  /* 标题样式 */
  h1 {
    font-size: 18pt !important;
    font-weight: bold !important;
    margin: 0 0 15pt 0 !important;
    page-break-after: avoid;
  }
  
  h2 {
    font-size: 16pt !important;
    font-weight: bold !important;
    margin: 15pt 0 10pt 0 !important;
    page-break-after: avoid;
  }
  
  h3 {
    font-size: 14pt !important;
    font-weight: bold !important;
    margin: 10pt 0 8pt 0 !important;
    page-break-after: avoid;
  }
  
  h4,
  h5,
  h6 {
    font-size: 12pt !important;
    font-weight: bold !important;
    margin: 8pt 0 5pt 0 !important;
    page-break-after: avoid;
  }
  
  /* 段落样式 */
  p {
    margin: 0 0 10pt 0 !important;
    line-height: 1.4 !important;
    orphans: 3;
    widows: 3;
  }
  
  /* 链接处理 */
  a {
    color: #000 !important;
    text-decoration: underline !important;
  }
  
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 90%;
  }
  
  a[href^="#"]:after,
  a[href^="javascript:"]:after {
    content: "";
  }
  
  /* 列表样式 */
  ul,
  ol {
    margin: 0 0 10pt 20pt !important;
  }
  
  li {
    line-height: 1.4 !important;
    margin-bottom: 3pt !important;
  }
  
  /* ================================
   * 图片和媒体优化
   * ================================ */
  
  img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
    border: 1px solid #ccc !important;
  }
  
  /* 隐藏背景图 */
  * {
    background-image: none !important;
  }
  
  /* ================================
   * 分页控制
   * ================================ */
  
  /* 强制分页 */
  .page-break-before {
    page-break-before: always !important;
  }
  
  .page-break-after {
    page-break-after: always !important;
  }
  
  .page-break-inside-avoid {
    page-break-inside: avoid !important;
  }
  
  /* 保持在一起 */
  .keep-together {
    page-break-inside: avoid !important;
  }
  
  /* 章节分页 */
  .chapter,
  .section {
    page-break-before: always !important;
  }
  
  /* ================================
   * WMS特定打印样式
   * ================================ */
  
  /* 订单打印 */
  .wms-order-print {
    .order-header {
      text-align: center;
      margin-bottom: 20pt !important;
      border-bottom: 2px solid #000 !important;
      padding-bottom: 10pt !important;
    }
    
    .order-info {
      display: flex;
      justify-content: space-between;
      margin-bottom: 15pt !important;
    }
    
    .order-details {
      margin-bottom: 20pt !important;
    }
    
    .order-footer {
      margin-top: 20pt !important;
      text-align: right;
      border-top: 1px solid #000 !important;
      padding-top: 10pt !important;
    }
  }
  
  /* 库存报表打印 */
  .wms-inventory-print {
    .inventory-summary {
      background: #f0f0f0 !important;
      padding: 10pt !important;
      margin-bottom: 15pt !important;
      border: 1px solid #000 !important;
    }
    
    .inventory-details {
      page-break-inside: auto;
    }
  }
  
  /* 标签打印 */
  .wms-label-print {
    width: 100% !important;
    height: auto !important;
    border: 2px solid #000 !important;
    padding: 10pt !important;
    text-align: center;
    
    .label-title {
      font-size: 14pt !important;
      font-weight: bold !important;
      margin-bottom: 8pt !important;
    }
    
    .label-content {
      font-size: 12pt !important;
      line-height: 1.5 !important;
    }
    
    .label-barcode {
      margin: 10pt 0 !important;
      text-align: center;
    }
  }
  
  /* 报表头部 */
  .wms-report-header {
    text-align: center;
    margin-bottom: 25pt !important;
    
    .report-title {
      font-size: 20pt !important;
      font-weight: bold !important;
      margin-bottom: 8pt !important;
    }
    
    .report-subtitle {
      font-size: 14pt !important;
      color: #666 !important;
      margin-bottom: 5pt !important;
    }
    
    .report-date {
      font-size: 10pt !important;
      color: #999 !important;
    }
  }
  
  /* 报表页脚 */
  .wms-report-footer {
    position: fixed;
    bottom: 1cm;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9pt !important;
    border-top: 1px solid #ccc !important;
    padding-top: 5pt !important;
  }
  
  /* ================================
   * 条码和二维码优化
   * ================================ */
  
  .wms-barcode,
  .wms-qrcode {
    text-align: center !important;
    margin: 10pt 0 !important;
    page-break-inside: avoid !important;
  }
  
  .wms-barcode img,
  .wms-qrcode img {
    max-width: 200pt !important;
    height: auto !important;
    border: none !important;
  }
  
  .wms-barcode-text,
  .wms-qrcode-text {
    font-family: "Courier New", monospace !important;
    font-size: 10pt !important;
    margin-top: 5pt !important;
  }
  
  /* ================================
   * 签名区域
   * ================================ */
  
  .wms-signature-area {
    margin-top: 30pt !important;
    border-top: 1px solid #000 !important;
    padding-top: 15pt !important;
    
    .signature-line {
      border-bottom: 1px solid #000 !important;
      width: 200pt !important;
      height: 20pt !important;
      display: inline-block !important;
      margin: 0 20pt 10pt 0 !important;
    }
    
    .signature-label {
      display: block !important;
      font-size: 9pt !important;
      margin-top: 3pt !important;
    }
  }
  
  /* ================================
   * 页面计数器
   * ================================ */
  
  .wms-page-counter {
    position: fixed;
    bottom: 0.5cm;
    right: 1cm;
    font-size: 9pt !important;
  }
  
  .wms-page-counter::after {
    content: "第 " counter(page) " 页，共 " counter(pages) " 页";
  }
  
  /* ================================
   * 打印质量优化
   * ================================ */
  
  /* 确保文本清晰 */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  /* 优化边框显示 */
  table,
  th,
  td {
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }
  
  /* 确保内容不被截断 */
  .wms-print-content {
    overflow: visible !important;
    white-space: normal !important;
  }
}